package com.example.course.schoolGet;

import com.example.course.ZSON;

import java.util.HashMap;

public class example extends schoolBase {
    private static boolean login = false;
    private static HashMap<String,String> cookies = null;
    private final HashMap<String,String> defaultHeader = new HashMap<String, String>(){{
        put("Accept", "*/*");
        put("Connection", "keep-alive");
        put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 HBPC/11.0.6.301");
    }};

     public example(){
         //记录教务能力，若可以执行为true，否则为false
         super.courseGet = true; //必选
         super.scoreGet = true;
         super.gpaGet = true;
         super.examGet = true;
         super.courseTime = new String[]{"01:45","08:30","10:30","14:00","16:00","18:45","20:45"};
    }

    @Override
    public String Login(String id, String pas,String verifyCode) {
        if(id.equals("000000") && pas.equals("010101011")){
            login = true;
            return ZSON.createObject().push("name","测试者").getObject().toString();
        }
        return null;
    }

    @Override
    public String getCourses() {
        if(login){
            return "{\"courses\":[[{\"name\":\"课程1\",\"idx\":2,\"last\":1,\"week\":[\"1-12\"],\"teacher\":\"李老师\"," +
                    "\"place\":\"A307\"}],[],[],[],[],[],[]],\"startDate\":\"2021-01-04\",\"warn\":\"数据仅供测试\"}";
        }
        return null;
    }

    @Override
    public String getScores() {
        if(login){
            return "[{\"name\":\"课程1\",\"value\": 90}]";
        }
        return null;
    }

    @Override
    public String getGPA() {
        if(login){
            return "{\"gpa\":3.8,\"all\":102,\"at\":33}";
        }
        return null;
    }

    @Override
    public String getExams() {
        if(login){
            return "[{\"name\":\"课程1考试\",\"place\":\"T202\",\"startDate\":\"2021-10-23\",\"time\":\"15:00~17:00\"}]";
        }
        return null;
    }
}
